﻿using Gp.Scripts.Core;
using UnityEngine;
using UnityEngine.EventSystems;

namespace Gp.Scripts.GUI
{
    public class DraggableEquipment : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler
    {
        // private InventorySlot _slot;
        public GameObject obj;
        private GameObject _temp;
        private bool _isDragging = false;

        private void Start()
        {
            // _slot = transform.GetComponent<InventorySlot>();
        }

        public void OnPointerDown(PointerEventData eventData) {
            // _temp = Instantiate(obj, Global.Get<GUIManager>().GetUIGroup(UIGroup.Inventory).transform);
            // _temp.GetComponent<Image>().sprite = _slot.IconImage.sprite;
        }
        
        public void OnDrag(PointerEventData eventData)
        {
            _temp.transform.localPosition = Global.Get<CursorManager>().MouseUIPosition(_temp.transform as RectTransform) ;
        }

        public void OnPointerUp(PointerEventData eventData)
        {
            Destroy(_temp);
            _isDragging = false;
        }
    }
}